﻿import QtQuick 2.12

Rectangle{

    id: root
    property bool checked: true
    property bool isHovered: false

    height: 30*dp
    width: 52*dp
    radius: height/2
    color: checked ? config.themeColor : "#CCCCCC"

    signal  clicked()

    Rectangle{
        y: 2
        height: root.height - 4
        width: height
        radius: height / 2
        x: checked ? root.width-width-2 : 2
    }

    MouseArea{
        anchors.fill: parent
        cursorShape: Qt.PointingHandCursor
        hoverEnabled: config.hoverEnabled
        onEntered: {
            isHovered = true
        }onExited: {
            isHovered = false
        }
        onClicked: {
//            checked = !checked
            root.clicked()
        }
    }

}
